#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
int x, y;
int d[] = { 0, 31, 29,31,30,31,30,31,31,30,31,30,31 };
int main()
{
	int cnt = 0;
	cin >> x >> y;
	for (int i = 1; i <= 12 ; i++)
	{
		for (int j = 1; j <= d[i]; j++)
		{
			int t = j % 10 * 1000 + j / 10 * 100 + i % 10 * 10 + i / 10;
			int num = t * 10000 + i * 100 + j;
			if ( x<= num && num <= y) cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}